home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga News 95
/
Amiga News 95.iso
/
dpat
/
dpat12
/
enterenv
/
enterenv.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-10-28
|
2KB
|
76 lines
/*
** $Application name : EnterEnv $
** $Revision : 1.1 $
** $Release : 1.01 $
** $Date : 92/10/28 $
**
**
**
** (C) Copyright 1992 David Scrève
** All Rights Reserved
*/
/* this software was compiled with SAS/C 5.10b Compiler. */
/* to Recompile this C source code, you need the include V37 or higher */
/* Contact the Commodore Amiga Technical Support for more information */
#include <stdio.h>
#include "dos/dos.h"
struct FileHandle *my_Handle;
struct Library *DosBase,*OpenLibrary();
void DOAction(ArgVector,ArgNumber)
char **ArgVector;
int ArgNumber;
{
char my_text[256];
char EnvValue[256]=" ";
LONG Resultat;
ArgVector++;
strcpy(my_text,"env:");
strcat(my_text,*ArgVector);
if (DosBase=(struct Library *)OpenLibrary("dos.library",37L))
{
my_Handle=(struct FileHandle *)Open(&my_text[0],MODE_NEWFILE);
if (my_Handle!=NULL)
{
if (ArgNumber==3)
{
ArgVector++;
printf("\n%s",*ArgVector);
}
gets(&EnvValue[0]);
Resultat=Write(my_Handle,&EnvValue[0],strlen(EnvValue));
if (Resultat==-1)
printf("\nUne Erreur d'écriture s'est produite.\n");
Close(my_Handle);
}
else
printf("\nImpossible d'ouvrir le fichier.\n");
CloseLibrary(DosBase);
}
else
printf("\n La Dos.library Version 37 m'est vitale. Je meurs...\n");
}
void WriteMessage()
{
printf("\nEnterEnv Release 1.01 By David Scrève. CopyRight (c) 1992");
printf("\nThis Software is freely distributable with the complete package.\n");
printf("\nSyntax : EnterEnv <Name of the Env Variable> [<Text message>]\n\n");
}
main(argc,argv)
int argc;
char **argv;
{
if (argc==1 || (argc==2 && (*argv[0]=='h' || *argv[0]=='H' || *argv[0]=='?')))
WriteMessage();
else
DOAction(argv,argc);
}